
		<view>
		  <navigator url="/pages/Constructionform/Constructionform" open-type="navigate">
		    <view style="background-color: #55aaff; color: #fff; text-align: center; padding: 8px; margin: 20px; border-radius: 10px;">
		      新增施工信息
		    </view>
		  </navigator>
		</view>
		
		<template>
		  <view>
		    <view v-for="(construction, index) in ConstructionRequestList" :key="index">
		       <navigator :url="`/pages/orderinfor/orderinfor?id=${construction.id}`"> 
		        <uni-card :is-shadow="false">
		          <view slot="title" class="card-title">计划编号: {{construction.formCode}}</view>
		          <uni-list>
		            <uni-list-item title="线路" :rightText="array2[construction.line]" />
		            <uni-list-item title="登记车站" :rightText="construction.registerByStation" />
		            <uni-list-item title="作业区段" :rightText="construction.workSection" />
		            <uni-list-item title="施工内容" :rightText="construction.workContent" />
		            <uni-list-item title="更新时间" :rightText="construction.formDate" />
		            <uni-list-item title="施工负责人" :rightText="construction.manageBy" />
		          </uni-list>
		        </uni-card>
		       </navigator> 
		    </view>
		    <uni-pagination @change="getList" :page-size="pageSize" :total="total" :current="current"></uni-pagination>
		  </view>
		</template>
		

<script>
	export default {
		data() {
			return {
				ConstructionRequestList:[],
				pageSize:10,
				total:0,
				current:1,
				array1: ['变电','工务','通信','信号','接触轨'],
				array2: ['十七号线','十三号线'],
				// formCode: "", // 从数据库获取的计划编号
				// line: "", // 从数据库获取的线路
				// regiserByStation: "", // 从数据库获取的车站
				// workSection: "", // 从数据库获取的施工范围
				// workContent: "", // 从数据库获取的施工内容
				// formDate: "", // 从数据库获取的更新时间
				// manageBy: "" ,// 从数据库获取的施工负责人
			}
		},
		methods: {
			getList() {
						uni.request({
							url: `http://localhost:82/constructionRequestBase/management/list?pageSize=${this.pageSize}&pageNum=${this.current}`, // 替换为实际的后端API地址
							method: 'GET',
							success: (res) => {
								console.log(res.data);
								// 从后端成功获取数据后，更新前端数据
								this.total=res.data.total
								this.ConstructionRequestList=res.data.rows
								console.log(this.ConstructionRequestList[0])
							},
							fail: (err) => {
							   console.error('Failed to fetch data from backend:', err);
							},
						});
					},
		},
		created() {
			this.getList()// 在组件创建时从后端获取数据
		}
	}
</script>

<style>
 .card-title {
    background-color: #3CB371;
    color: white;
    font-weight: bold;
    padding: 10px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
  }
  
</style>
